<?php
/**
 * Created by PhpStorm.
 * User: WhiteBlue
 * Date: 15/3/2
 * Time: 下午3:07
 */

use Illuminate\Database\Capsule\Manager;

//启动器
class bootstrap
{
    public static function boot()
    {
        $route = split("/", $_SERVER['PHP_SELF']);
        define('URL_BASE', $_SERVER['HTTP_HOST'] . '/' . $route[1] . '/index.php');
        define('BASE_PATH', $_SERVER['HTTP_HOST'] . '/' . $route[1]);
        define('FILE_PATH', dirname(dirname(__DIR__)));
        define('ASSET_PATH', BASE_PATH . '/app/assets');
        define('VIEW_PATH', FILE_PATH . '/app/views/');

        $capsule = new Manager();
        $capsule->addConnection(require './app/configs/database.php');
        $capsule->bootEloquent();
        unset($capsule);

        $whoops = new \Whoops\Run;
        $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
        $whoops->register();
        unset($whoops);
    }
}
